﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using COM.OA.Entity;
using COM.OA.BLL;
using System.Collections.Generic;

public partial class qs_rizhi_rizhineirong : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string biaoti=this.Request.QueryString["w_id"];
        int wid = Int32.Parse(biaoti);
      
        worklog wl = worklogBLL.Select(wid);
        string biaotiming = wl.w_title;

        //点击+1后存入数据库
        int dianji = wl.w_clicks + 1;
        
        //重新封装新对象
        worklog wll = new worklog();
        wll.w_id = wl.w_id;
        wll.w_u_id = wl.w_u_id;
        wll.w_title = wl.w_title;
        wll.w_content = wl.w_content;
        wll.w_clicks = dianji;
        wll.w_state = wl.w_state;
        wll.w_sendtime = wl.w_sendtime;
        wll.w_readerid = wl.w_readerid;
        wll.w_readtime = wl.w_readtime;
        wll.w_readcontent = wl.w_readcontent;
        //更新数据库

        worklogBLL.Update(wll);



        //取批阅人ID
        int pid=wl.w_readerid;
        if (pid <= 0)
        {
            this.lbPiYue.Text = "";
        }
        else
        {
            users us = usersBLL.Select(pid);
            this.lbPiYue.Text = us.u_username;
        }
        

        //给页面显示
        this.lbBiaoTi.Text = biaotiming;
        this.lbSendTime.Text = wl.w_sendtime.ToString();
        this.lbDianJi.Text = dianji.ToString();

        this.lbNeiRong.Text = wl.w_content;
        //如果批阅内容为空不显示任何批阅信息
        if (wl.w_readcontent.Equals(""))
        {
            this.lbPeiNeiRong.Text = "";
            this.lbPeiTime.Text = "";
        }
        else 
        {
            this.lbPeiNeiRong.Text = wl.w_readcontent;
            this.lbPeiTime.Text = wl.w_readtime.ToString();
        }
       

    }
}
